﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;
using TinyForum.Web.Extensions.Mvc;
using TinyForum.Web.Proxies.ServiceReference;

namespace TinyForum.Web.Controllers
{
    public class TopicController : ThemeController
    {
        public ActionResult ListPosts(long id)
        {
            using (TopicApplicationClient topicApplicationClient = new TopicApplicationClient())
            {
                var topic = topicApplicationClient.GetTopicById(id);
                ViewBag.TopicName = topic.Name;
                var model = topicApplicationClient.GetPosts(id, PostSortDataObject.PostDate, SortOrderDataObject.Descending);
                return View(model);
            }
        }

    }
}
